package com.da.lon.wang.xlg.adapter;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.da.lon.wang.xlg.R;

import java.util.List;

public class PartyAdPageAdapter extends PagerAdapter {

    private LayoutInflater inflater;
    private List<String> list;

    public PartyAdPageAdapter(Context context, List<String> list) {
        this.list = list;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return list != null ? list.size() : 0;
    }

    @Override
    public boolean isViewFromObject(View arg0, Object arg1) {
        // TODO Auto-generated method stub
        return arg0 == ((View) arg1);
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        // TODO Auto-generated method stub
        View view = inflater.inflate(R.layout.ocoffee_party_ad_item, null);
        ImageView imageView1 = (ImageView) view
                .findViewById(R.id.party_sort_image1);
        ImageView imageView2 = (ImageView) view
                .findViewById(R.id.party_sort_image2);
        ImageView imageView3 = (ImageView) view
                .findViewById(R.id.party_sort_image3);
        ImageView imageView4 = (ImageView) view
                .findViewById(R.id.party_sort_image4);
        container.addView(view);
        return view;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        // TODO Auto-generated method stub

        container.removeView((View) object);
    }

}
